<?php
echo form_open_multipart('employee/edit_employee');
if ($this->session->userdata('edit_erro')) {
	echo $this->session->userdata('edit_erro');
	$this->session->unset_userdata('edit_erro');
}
?>
<div id="request-style-boder"> 
	<div id="request-style">
		<div class="request-style">
			<strong class="form-request-heading">EDIT EMPLOYEE</strong>
			<hr style="margin-top:10px; height:2px;">
			<table>
				<tbody>
					<?php
					foreach ($edit_emp->result() as $row) {
						?>
						<tr>
							<td class="txt">Staff ID<span class="star">*</span></td>
							<td class="txt1">:</td>
							<td class="input_txt">
								<?php
								echo form_hidden('old_id', $row->emp_id);
								echo form_input(array('name' => 'txt_id', 'value' => $row->emp_id, 'class' => 'span3')) . form_error('txt_id', '<span class="req-error">', '</span>');
								?>
							</td>
						</tr>
						<tr>
							<td class="txt">First Name<span class="star">*</span></td>
							<td class="txt1">:</td>
							<td class="input_txt"><?php
							echo form_hidden('old_fname', $row->emp_fname);
							echo form_input(array('name' => 'txt_fname', 'value' => $row->emp_fname, 'class' => 'span3')) . form_error('txt_fname', '<span class="req-error">', '</span>');
								?></td>
						</tr>
						<tr>
							<td class="txt">Last Name<span class="star">*</span></td>
							<td class="txt1">:</td>
							<td class="input_txt"><?php
							echo form_hidden('old_lname', $row->emp_lname);
							echo form_input(array('name' => 'txt_lname', 'value' => $row->emp_lname, 'class' => 'span3')) . form_error('txt_lname', '<span class="req-error"', '</span>');
								?></td>
						</tr>
						<tr>
							<td class="txt">Gender<span class="star">*</span></td>
							<td class="txt1">:</td>
							<td class="input_txt"><?php
							echo form_hidden('old_gender', $row->emp_gender);
							echo form_dropdown('txt_gender', $option_gender, $row->emp_gender, 'class="span3"');
								?></td>
						</tr>
						<tr>
							<td class="txt">Picture</td>
							<td class="txt1">:</td>
							<td class="input_txt"><?php echo form_upload('txt_photo') . form_hidden('src_img', $row->emp_photo); ?></td>
						</tr>
						<tr>
							<td class="txt">Start Work Date</td>
							<td class="txt1">:</td>
							<td class="input_txt">
								<?php
								echo form_input('txt_start_workdate', $row->start_date_work, 'id="workingon" class="span3"') . form_error('txt_start_workdate', '<span class="req-error">', '</span>'). form_hidden('old_start_workdate', $row->start_date_work);
								?>
								<input type="hidden" name="working_on" id="working_on_alternate" />
							</td>
						</tr>
						<tr>
							<td class="txt">Position<span class="star">*</span></td>
							<td class="txt1">:</td>
							<td class="input_txt"><?php echo form_dropdown('txt_position', $option_pos, $row->pos_id, 'class="span3"') . form_hidden('old_position', $row->pos_id); ?></td>
						</tr>
						<tr>
							<td class="txt">Role<span class="star">*</span></td>
							<td class="txt1">:</td>
							<td class="input_txt"><?php echo form_dropdown('txt_role', $option_role, $row->role_id, 'class="span3"') . form_hidden('old_role', $row->role_id); ?></td>
						</tr>
						<tr>
							<td class="txt">Status<span class="star">*</span></td>
							<td class="txt1">:</td>
							<td class="input_txt"><?php echo form_dropdown('txt_status', $option_status, $row->emp_status, 'class="span3"') . form_hidden('old_status', $row->emp_status); ?></td>
						</tr>
						<tr>
							<td class="txt">Department<span class="star">*</span></td>
							<td class="txt1">:</td>
							<td class="input_txt"><?php echo form_dropdown('txt_dept', $option_dept, $row->dept_id, 'class="span3" id="dept_id" onchange="getValue(this)"') . form_hidden('old_dept', $row->dept_id); ?></td>
						</tr>

						<?php
						if ($this->session->userdata('get_dept_alias') === 'training') {
							if ($edit_subdept) {
								foreach ($edit_subdept->result() as $data) {
									?>
									<tr>
										<td class="txt">Sub Department<span class="star">*</span></td>
										<td class="txt1">:</td>
										<td class="input_txt"><?php echo form_dropdown('txt_sub_dept', $option_sub_dept, $data->dept_id, 'class="span3" id="mysub_id"') . form_hidden('old_sub_dept', $data->dept_id); ?></td>
									</tr>			
									<?php
								}
							}
						} else {
							?>
							<tr>
								<td class="txt">Sub Department<span class="star">*</span></td>
								<td class="txt1">:</td>
								<td class="input_txt"><?php echo form_dropdown('txt_sub_dept', $option_sub_dept, set_value('txt_sub_dept'), 'class="span3" id="mysub_id" disabled'); ?></td>
							</tr>
						<?php } ?>


<!--						<tr>
							<td class="txt">Group<span class="star">*</span></td>
							<td class="txt1">:</td>
							<td class="input_txt"><?php echo form_dropdown('txt_group', $option_grp, $row->grp_id, 'class="span3"') . form_hidden('old_group', $row->grp_id); ?></td>
						</tr>-->
						<tr>
							<td colspan="2"></td>
							<td style="float:right;">
								<?php
								$submit = array('name' => 'btn_edit', 'value' => 'Update');
								echo anchor('employee/show_employee', form_button('btn_Cancel', 'Cancel', 'class="btn btn-info"'), 'style="text-decoration:none;"') . nbs(2) . form_submit($submit, '', ' class="btn btn-info" ');
								?>
							</td>
						</tr>
					<?php } ?>
				</tbody>
			</table> 
			<?php echo form_close(); ?>
		</div>
	</div>
</div>